import request from '@/config/axios'

export interface Demo02CategoryVO {
  id: number
  name: string
  parentId: number
}

export const getDemo02CategoryPage = async (params) => {
  return await request.get({ url: `/infra/demo02Category`, params })
}

// 查询示例分类列表
export const getDemo02CategoryList = async (params) => {
  return await getDemo02CategoryPage({...params, pageSize: -1}).then(resp => resp.list)
}

// 查询示例分类详情
export const getDemo02Category = async (id: number) => {
  return await request.get({ url: `/infra/demo02Category/` + id })
}

// 新增示例分类
export const createDemo02Category = async (data: Demo02CategoryVO) => {
  return await request.post({ url: `/infra/demo02Category`, data })
}

// 修改示例分类
export const updateDemo02Category = async (data: Demo02CategoryVO) => {
  return await request.put({ url: `/infra/demo02Category`, data })
}

// 删除示例分类
export const deleteDemo02Category = async (id: number) => {
  return await request.delete({ url: `/infra/demo02Category`, data: [id] })
}

// 导出示例分类 Excel
export const exportDemo02Category = async (params) => {
  return await request.download({ url: `/infra/demo02Category/export`, params })
}
